{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. Configurable Scenario Generation\n",
    "\n",
    "In this notebook, we demonstrate the capabilities of the configurable scenario generation of BARK. First, we clarify what a BARK scenario is, to then describe how the configurable scenario generation allows flexible, extensible creation of a variety of scenario types.\n",
    "\n",
    "## 3.1 BARK Scenarios\n",
    "\n",
    "A BARK scenario contains a list of agents\n",
    "with their initial states, behavior, execution and dynamic\n",
    "models as well as a goal definition for each agent. Further,\n",
    "it contains a map file in the OpenDrive format. To support\n",
    "behavior benchmarking, each scenario specifies which agent\n",
    "is considered as the ‘controlled’ agent during the simulation.\n",
    "A BARK scenario does not explicitly specify how agents\n",
    "will behave over time, e.g. using predefined maneuvers or\n",
    "trajectories. \n",
    "\n",
    "A BARK scenario thus uses the following implementation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Scenario:\n",
    "  def __init__(self,\n",
    "               agent_list=None,\n",
    "               eval_agent_ids=None,\n",
    "               map_file_name=None,\n",
    "               json_params=None,\n",
    "               map_interface=None):\n",
    "    self._agent_list = agent_list or []\n",
    "    self._eval_agent_ids = eval_agent_ids or []\n",
    "    self._map_file_name = map_file_name\n",
    "    self._json_params = json_params\n",
    "    self._map_interface = map_interface"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The scenario class separately persists agents and the map file name. When multiple scenarios are based on the same map file, this then avoids serialization of processed map information in all the scenarios. In contrast, agents are fully serialized via python pickling. For this, the C++ agent class and all members, e.g behavior models suport python serialization.\n",
    "\n",
    "Before starting to run a scenario. The benchmark runner then calls `_build_world_state` to create the world state used in a simulation run:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "  def _build_world_state(self):\n",
    "    param_server = ParameterServer(json=self._json_params)\n",
    "    world = World(param_server)\n",
    "    if self._map_interface is None:\n",
    "      world = self.SetupMap(world, self._map_file_name)\n",
    "    else:\n",
    "      world.SetMap(self._map_interface)\n",
    "    for agent in self._agent_list:\n",
    "      agent.GenerateRoadCorridor(self._map_interface)\n",
    "      world.AddAgent(agent)\n",
    "    return world"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.2 BARK Scenario Generation\n",
    "\n",
    "Based on the scenario definition, we define a Scenario Generation base class being responsible to create a list of scenario and managing saving, loading of scenario sets and getting of scenarios. The simplified structure of BARK's base scenario generation is:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "class ScenarioGeneration:\n",
    "  def __init__(self, params=None, num_scenarios=None, random_seed=1000):\n",
    "    self._params = params\n",
    "    self._current_scenario_idx = 0\n",
    "    self._random_seed = random_seed\n",
    "\n",
    "    self._scenario_list = self.create_scenarios(params, num_scenarios)\n",
    "\n",
    "  def get_scenario(self, idx):\n",
    "    return self._scenario_list[idx].copy()\n",
    "\n",
    "  def dump_scenario_list(self, filename):\n",
    "    with open(filename, \"wb\") as file:\n",
    "      # print(\"SAVE PATH:\", os.path.abspath(filename))\n",
    "      pickle.dump(self._scenario_list, file)\n",
    "\n",
    "  def load_scenario_list(self, filename):\n",
    "    with open(filename, \"rb\") as file:\n",
    "      self._scenario_list = pickle.load(file)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This base class allows to easily create new scenario generations while enabling easy integration in to BARK's benchmarking and ML training platforms which use these common interfaces.\n",
    "\n",
    "Let's have a look how what the configurable scenario generation provides."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.3 Concept of Configurable Scenario Generation\n",
    "\n",
    "Though, new scenarios generations are supported with the common interface, we require a modularized perspective on the set of features characterizing a scenario. For instance, we want to configure initial states of agents independently of behavior models or goal configurations. To achieve this, we must ensure that configuration options for one set of features can easily be combined with other sets of features. The configurable scenario generation implements this requirement.\n",
    "\n",
    "The fundamental building blocks of a scenario in the configurable scenario generation are source sink pairs. A source sink pair defines a road corridor in the map. It is specified with either a pair of OpenDrive Road Ids or a pair of X/Y Points. \n",
    "\n",
    "For each source sink pair, multiple config readers are responsible to create the features within this sink source pair. Config readers exist for each relevant property in a scenario which are processed for a source sinks pair in a specific order. Information from config reader is passed to the next readers. We distinguish between fundamdental information to build a scenario which must be returned by a config reader and optional information which may be passed and could be incorporated by subsequent readers. The information flow to create the agents in a **single** source sink config is as follows \n",
    "\n",
    "1. ConfigReaderAgentStatesAndGeometries: \n",
    "    - Retrieves: Road corridor of this source sink\n",
    "    - Must return: list of agent states and a list of agent shapes\n",
    "    - Optional return: e.g. list of agent ids, lane positions,\n",
    "2. ConfigBehaviorModels:\n",
    "    - Retrieves: Road corridor of this source sink, agent state list, collected optional returns\n",
    "    - Must return: list of behavior models for each agent in agent state list\n",
    "    - Optional return: e.g. list of types of behavior models\n",
    "3. ConfigExecutionModels:\n",
    "    - Retrieves: Road corridor of this source sink, agent state list, collected optional returns\n",
    "    - Must return: list of execution models for each agent in agent state list\n",
    "    - Optional return: e.g. list of types of execution models\n",
    "4. ConfigDynamicModels:\n",
    "    - Retrieves: Road corridor of this source sink, agent state list, collected optional returns\n",
    "    - Must return: list of dynamic models for each agent in agent state list\n",
    "    - Optional return: e.g. list of types of dynamic models\n",
    "5. ConfigControlledAgents:\n",
    "    - Retrieves: Road corridor of this source sink, agent state list, collected optional returns\n",
    "    - Must return: List of size agent state list with True or False indicating if agent is controlled in a     benchmarking run or not\n",
    "    - Optional return: normally nothing\n",
    "6. ConfigGoalDefinitions:\n",
    "    - Retrieves: Road corridor of this source sink, agent state list, list of controlled_agent_ids, collected optional returns\n",
    "    - Must return: List of goal definitions one for each agent in agent state list\n",
    "    - Optional return: normally nothing\n",
    "    \n",
    "Returns are collected and finally the agents for the source sink config are created. Then, the chain is run for the next source sink config. The interfaces of all config reader types are implemented in \n",
    "[config_readers_interfaces.py](https://github.com/bark-simulator/bark/blob/master/bark/runtime/scenario/scenario_generation/config_readers/config_readers_interfaces.py)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.4 Understanding Parameter Files\n",
    "\n",
    "Let's have a look at the default parameter file of the configurable scenario generation to better understand this concept:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Changing to bark root /home/julo/.cache/bazel/_bazel_julo/6148542f54f1c4e49e4ced7294c97977/execroot/bark_project/bazel-out/k8-fastbuild/bin/docs/tutorials/run.runfiles/bark_project\n",
      "Writing parameters to /home/julo/.cache/bazel/_bazel_julo/6148542f54f1c4e49e4ced7294c97977/execroot/bark_project/bazel-out/k8-fastbuild/bin/docs/tutorials/run.runfiles/bark_project/default_params.json\n",
      "\n",
      "\n",
      " ------ Scenario Default Parameters ---------\n",
      "{\n",
      "    \"Scenario\": {\n",
      "        \"Generation\": {\n",
      "            \"ConfigurableScenarioGeneration\": {\n",
      "                \"MapFilename\": \"bark/runtime/tests/data/city_highway_straight.xodr\",\n",
      "                \"SinksSources\": [\n",
      "                    {\n",
      "                        \"SourceSink\": [\n",
      "                            [\n",
      "                                5111.626,\n",
      "                                5006.8305\n",
      "                            ],\n",
      "                            [\n",
      "                                5110.789,\n",
      "                                5193.1725\n",
      "                            ]\n",
      "                        ],\n",
      "                        \"Description\": \"left_lane\",\n",
      "                        \"ConfigAgentStatesGeometries\": {\n",
      "                            \"Type\": \"UniformVehicleDistribution\",\n",
      "                            \"LanePositions\": [\n",
      "                                0\n",
      "                            ],\n",
      "                            \"VehicleDistanceRange\": [\n",
      "                                10,\n",
      "                                20\n",
      "                            ],\n",
      "                            \"OtherVehicleVelocityRange\": [\n",
      "                                20,\n",
      "                                30\n",
      "                            ],\n",
      "                            \"SRange\": [\n",
      "                                0.1,\n",
      "                                0.7\n",
      "                            ]\n",
      "                        },\n",
      "                        \"ConfigBehaviorModels\": {\n",
      "                            \"Type\": \"FixedBehaviorType\",\n",
      "                            \"ModelType\": \"BehaviorIDMClassic\",\n",
      "                            \"ModelParams\": {\n",
      "                                \"BehaviorIDMClassic\": {\n",
      "                                    \"MaxVelocity\": 60.0,\n",
      "                                    \"MinimumSpacing\": 2.0,\n",
      "                                    \"DesiredTimeHeadway\": 1.5,\n",
      "                                    \"MaxAcceleration\": 1.7000000476837158,\n",
      "                                    \"AccelerationLowerBound\": -5.0,\n",
      "                                    \"AccelerationUpperBound\": 8.0,\n",
      "                                    \"DesiredVelocity\": 15.0,\n",
      "                                    \"ComfortableBrakingAcceleration\": 1.6699999570846558,\n",
      "                                    \"MinVelocity\": 0.0,\n",
      "                                    \"Exponent\": 4\n",
      "                                }\n",
      "                            }\n",
      "                        },\n",
      "                        \"ConfigExecutionModels\": {\n",
      "                            \"Type\": \"FixedExecutionType\",\n",
      "                            \"ModelType\": \"ExecutionModelInterpolate\"\n",
      "                        },\n",
      "                        \"ConfigDynamicModels\": {\n",
      "                            \"Type\": \"FixedDynamicType\",\n",
      "                            \"ModelType\": \"SingleTrackModel\"\n",
      "                        },\n",
      "                        \"ConfigGoalDefinitions\": {\n",
      "                            \"Type\": \"FixedGoalTypes\",\n",
      "                            \"GoalTypeControlled\": \"EndOfLane\",\n",
      "                            \"GoalTypeOthers\": \"EndOfLane\",\n",
      "                            \"MaxLateralDist\": [\n",
      "                                0.1,\n",
      "                                0.1\n",
      "                            ],\n",
      "                            \"LongitudinalRange\": [\n",
      "                                0,\n",
      "                                1.0\n",
      "                            ],\n",
      "                            \"MaxOrientationDifference\": [\n",
      "                                0.08,\n",
      "                                0.08\n",
      "                            ],\n",
      "                            \"VelocityRange\": [\n",
      "                                10,\n",
      "                                20\n",
      "                            ]\n",
      "                        },\n",
      "                        \"ConfigControlledAgents\": {\n",
      "                            \"Type\": \"NoneControlled\"\n",
      "                        },\n",
      "                        \"AgentParams\": {\n",
      "                            \"MaxHistoryLength\": 50\n",
      "                        }\n",
      "                    },\n",
      "                    {\n",
      "                        \"SourceSink\": [\n",
      "                            [\n",
      "                                5111.626,\n",
      "                                5006.8305\n",
      "                            ],\n",
      "                            [\n",
      "                                5110.789,\n",
      "                                5193.1725\n",
      "                            ]\n",
      "                        ],\n",
      "                        \"Description\": \"right_lane\",\n",
      "                        \"ConfigAgentStatesGeometries\": {\n",
      "                            \"Type\": \"UniformVehicleDistribution\",\n",
      "                            \"LanePositions\": [\n",
      "                                1\n",
      "                            ],\n",
      "                            \"VehicleDistanceRange\": [\n",
      "                                10,\n",
      "                                20\n",
      "                            ],\n",
      "                            \"OtherVehicleVelocityRange\": [\n",
      "                                20,\n",
      "                                30\n",
      "                            ],\n",
      "                            \"SRange\": [\n",
      "                                0.1,\n",
      "                                0.7\n",
      "                            ]\n",
      "                        },\n",
      "                        \"ConfigBehaviorModels\": {\n",
      "                            \"Type\": \"FixedBehaviorType\",\n",
      "                            \"ModelType\": \"BehaviorIDMClassic\",\n",
      "                            \"ModelParams\": {\n",
      "                                \"BehaviorIDMClassic\": {\n",
      "                                    \"MaxVelocity\": 30.0,\n",
      "                                    \"MinimumSpacing\": 2.0,\n",
      "                                    \"DesiredTimeHeadway\": 1.5,\n",
      "                                    \"MaxAcceleration\": 1.7000000476837158,\n",
      "                                    \"AccelerationLowerBound\": -5.0,\n",
      "                                    \"AccelerationUpperBound\": 8.0,\n",
      "                                    \"DesiredVelocity\": 15.0,\n",
      "                                    \"ComfortableBrakingAcceleration\": 1.6699999570846558,\n",
      "                                    \"MinVelocity\": 0.0,\n",
      "                                    \"Exponent\": 4\n",
      "                                }\n",
      "                            }\n",
      "                        },\n",
      "                        \"ConfigExecutionModels\": {\n",
      "                            \"Type\": \"FixedExecutionType\",\n",
      "                            \"ModelType\": \"ExecutionModelInterpolate\"\n",
      "                        },\n",
      "                        \"ConfigDynamicModels\": {\n",
      "                            \"Type\": \"FixedDynamicType\",\n",
      "                            \"ModelType\": \"SingleTrackModel\"\n",
      "                        },\n",
      "                        \"ConfigGoalDefinitions\": {\n",
      "                            \"Type\": \"FixedGoalTypes\",\n",
      "                            \"GoalTypeControlled\": \"EndOfLane\",\n",
      "                            \"GoalTypeOthers\": \"EndOfLane\",\n",
      "                            \"MaxLateralDist\": [\n",
      "                                0.1,\n",
      "                                0.1\n",
      "                            ],\n",
      "                            \"LongitudinalRange\": [\n",
      "                                0,\n",
      "                                1.0\n",
      "                            ],\n",
      "                            \"MaxOrientationDifference\": [\n",
      "                                0.08,\n",
      "                                0.08\n",
      "                            ],\n",
      "                            \"VelocityRange\": [\n",
      "                                10,\n",
      "                                20\n",
      "                            ]\n",
      "                        },\n",
      "                        \"ConfigControlledAgents\": {\n",
      "                            \"Type\": \"RandomSingleAgent\"\n",
      "                        },\n",
      "                        \"AgentParams\": {\n",
      "                            \"MaxHistoryLength\": 50\n",
      "                        }\n",
      "                    }\n",
      "                ],\n",
      "                \"ConflictResolution\": {\n",
      "                    \"left_lane/right_lane\": [\n",
      "                        0.2,\n",
      "                        0.8\n",
      "                    ]\n",
      "                }\n",
      "            }\n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "import config_notebook\n",
    "import json\n",
    "from bark.runtime.scenario.scenario_generation.configurable_scenario_generation import ConfigurableScenarioGeneration\n",
    "from bark.runtime.commons.parameters import ParameterServer\n",
    "import os\n",
    "\n",
    "params = ParameterServer()\n",
    "\n",
    "scenario_generation = ConfigurableScenarioGeneration(num_scenarios = 5, params = params)\n",
    "\n",
    "params.Save(\"default_params.json\")\n",
    "print(\"\\n\\n ------ Scenario Default Parameters ---------\")\n",
    "print(json.dumps(params.ConvertToDict(), indent=4))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In the default configuration, we have two sources and sinks specified. One for the left lane of the road corridor on an highway, one for the right lane. We use the config reader type UniformVehicleDistribution for  ConfigAgentStatesGeometries. There, we can specify vehicle distance ranges and ranges of initial velocity. As behavior model config, we use FixedBehaviorType, where one type of behavior model with its parameters is specified. Goal definition uses config reader FixedGoalTypes enabling separate specification of goal definitions for controlled and non-controlled agents. It uses a FrenetGoalType with a geometric goal region around the centerline of the goal lane. The range of this region is specified via parameter LongitudinalRange. With BARKs runtime, we can have a look through the sceanarios created with the default parameter config:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAIuCAYAAAC7EdIKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XuQ3XV9//H3OXs2myy7uXBLkEhC4HBCLpAJERAKHYiKFRhbKSr4B0jROhAtI5cibYG2g0JrO8XSjk5rxwItUkBHSVsdmEZEFDBpKgjkcCCIlQaScMk9Ibvn+/uDur9Gkm+yfHP2Gz77eMxkJnvO93vOazPDzpNz20qWZQEAkLJq2QMAADpN8AAAyRM8AEDyBA8AkDzBAwAkT/AAAMmr5V154IEHZtOnTx+hKUCnrFu3LiZMmDD09cDAQGzevDmG+7EUXV1d0dfXV3jPwOOPR0REbe7cPTr+V/cD7MyyZcvWZll20M6uyw2e6dOnx9KlSzuzChgxixcvjrPOOmvo67Vr18bSpUtjYGBgWLczfvz4OPXUUwvvWT1tWkREHLyHP19+dT/AzlQqled3dZ2ntGAUGjNmzFs6r6enZy8vARgZggdGod7e3hgcHBz2ef39/R1YA9B5ggdGoVqtFl1dXcM6p1qt7pXX7wCUQfDAKDXcR2sqlUqMHz++Q2sAOkvwwCg1e/bsqFb37EdApVKJSZMmxcSJEzu8CqAzBA+MUhMnTozJkydHpVLZ7bGVSiWOOeaYXV7fbDb35jSAvU7wwCg2Z86cqFarudFTrVbj8MMPj97e3l0e02q1OjEPYK/J/RweIG09PT1x0kknxZo1a+K1116L9evXx9atW4c+YHDixIkxYcKEOOSQQ8qeClCI4IFRbsKECT7FGEiep7QAg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edFKtWrYoDDjigY/dxxx13RKVSibPOOqtj9wEAo1VtJO7knHPOic2bN8dXv/rVOPLII2P16tXxwAMPxMsvvzwSd1/I9u3bY8yYMTFlypSO3cfKlSvjyiuvjFNOOaVj9wGdVK/Xy54AkKvjj/C89tpr8eCDD8aNN94YCxcujGnTpsW73vWuuOKKK+KjH/3o0HGvv/56XHPNNTFt2rTo6emJGTNmxJe+9KWh65988sk488wzo7+/Pw4++OA477zz4sUXXxy6/sILL4yzzjorbr755jj00ENj0qRJ8fGPfzw2b948dMx3vvOdOOWUU2LSpEmx//77xxlnnBFPPfXU0PU/+9nPolKpxB133BGnn356jBs3Lr7yla/s9Cmtb3zjGzF37tzo6emJd77znXHDDTdElmXD/vfZvn17nHfeeXHDDTfEjBkzhn0+7AsajUbZEwBydTx4+vr6oq+vL7797W/H1q1bd3ncBRdcELfeemv85V/+ZTz11FPx1a9+NSZOnBgREatWrYpTTz015syZE48++mjcf//9sXHjxvjgBz8Y7XZ76DYefPDB+OlPfxr3339/3HnnnfHNb34zbr755qHrN23aFJdddlk8+uij8b3vfS8mTJgQZ599drz++us7bPnc5z4Xl1xySTz55JPxm7/5m2/aumzZsjj33HPjQx/6UDz++ONx4403xhe+8IW45ZZbho65/vrro1Kp7Pbf5w/+4A9i+vTpccEFF+z2WADgLcqybJd/jjvuuGxvuPvuu7NJkyZlPT092Yknnphdfvnl2cMPPzx0/dNPP51FRPbv//7vOz3/j/7oj7LTTz99h8teeeWVLCKyRx55JMuyLLvggguyqVOnZgMDA0PHXHzxxdnChQt3uWvjxo1ZtVrNHnzwwSzLsuy5557LIiL74he/uMNxS5YsySIiW7NmTZZlWXb++ednp5122g7HXHfdddmhhx469PVf//VfZ41GY5f3nWVZ9t3vfjebNm1a9uqrrw59D2eeeWbuOfBW3HvvvWVP2MFLhx2WvXTYYXt8/L62H9g3RcTSbBdNMyIvWj7nnHPif/7nf+Lee++N3/iN34gf/vCHceKJJ8bnP//5iIhYvnx5VKvVOO2003Z6/rJly+L73//+0KNFfX198c53vjMiIp599tmh42bNmhVdXV1DX7/jHe+I1atXD3397LPPxvnnnx9HHHFEjB8/PiZPnhztdjt+/vOf73B/CxYsyP1+nnrqqTj55JN3uOzXfu3X4oUXXoj169dHRMSiRYtixYoVu7yNNWvWxIUXXhj/+I//OPRIFgDQGSPyouWIiLFjx8Z73/veeO973xvXXnttXHzxxXH99dfHFVdcsdtz2+12nHnmmfHFL37xTddNnjx56O/d3d07XFepVHZ4yuuss86KqVOnxle+8pU49NBDo1arxaxZs970lNZ+++033G9vh/vcE0888USsWrUqFi5cOHTZL7fWarV44oknvC4CAPaSEQueXzVr1qwYGBiIrVu3xrx586LdbseSJUvi/e9//5uOnT9/fvzLv/xLTJs27U1Rs6defvnlWLFiRfzt3/7t0CNJ//mf/xkDAwPDvq2jjz46HnrooR0u+8EPfhBTp06N/v7+PbqNd73rXfH444/vcNkf/uEfxquvvhp/8zd/E4cffviwdwEAO9fxp7RefvnlOP300+P222+Pxx57LJ577rm466674s/+7M9i4cKFMX78+DjqqKPiwx/+cFx88cVxzz33xHPPPRcPPvhg3HbbbRERcemll8a6deviIx/5SDzyyCOxcuXKuP/+++OTn/xkbNiwYY92TJo0KQ488MD4u7/7u3jmmWfigQceiE996lNRqw2/+S6//PJ44IEH4vrrr4+nn346/umf/in+4i/+Iq666qqhY2655ZaYOXPmLm9jv/32izlz5uzwZ+LEidHf3x9z5syJMWPGDHsXALBzI/IurRNPPDFuvvnm+PVf//WYPXt2XHPNNXH++efHnXfeOXTcrbfeGueff3585jOfiZkzZ8aFF14Y69ati4g3Xovz0EMPRbVajfe///0xe/bsuPTSS6Onpyd6enr2aEe1Wo0777wzHnvssZgzZ05ceuml8ad/+qd7fP7/NX/+/LjrrrvinnvuiTlz5sTVV18dV199dSxatGjomLVr1/qFigCwj6hkOZ8ds2DBgmzp0qUjOAfohMWLF+9Tn+K9etq0iIg4+Pnn9+j4fW0/sG+qVCrLsizb6TuP/C4toDCPZgL7OsEDFNZqtcqeAJ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g==\n",
      "text/plain": [
       "<Figure size 720x720 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython import display\n",
    "\n",
    "from bark.runtime.viewer.matplotlib_viewer import MPViewer\n",
    "from bark.runtime.runtime import Runtime\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.figure(figsize=(10, 10))\n",
    "viewer = MPViewer(\n",
    "  params=params,\n",
    "  y_length = 80,\n",
    "  enforce_y_length=True,\n",
    "  enforce_x_length=False,\n",
    "  follow_agent_id=True,\n",
    "  axis=plt.gca())\n",
    "\n",
    "\n",
    "num_scenarios_to_show = 5\n",
    "num_steps_per_scenario = 4\n",
    "step_time = 0.2\n",
    "\n",
    "for _ in range(0, num_scenarios_to_show):\n",
    "    scenario, idx = scenario_generation.get_next_scenario()\n",
    "    world = scenario.GetWorldState()\n",
    "    for _ in range(0, num_steps_per_scenario): \n",
    "      viewer.drawWorld(world, eval_agent_ids=scenario._eval_agent_ids, scenario_idx=idx )\n",
    "      display.clear_output(wait=True)\n",
    "      display.display(viewer.axes.get_figure())\n",
    "      world.Step(step_time)\n",
    "      viewer.clear()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We see the controlled agent in red and its goal region on the right lane. We now tune the parameters that the controlled agents goal is on the left lane. Additionally, we want to create more dense traffic on the left lane to make the lane change scenario harder. We decrease the range for sampling distances and velocity. Further and recreate the scenarios:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAIuCAYAAAC7EdIKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X2UVPVh//HPvXd2Z3f2GZAHQ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fffLPWrVunv/3bv9WiRYvU2dk55Ne6d+9eXXTRRbr66qv15JNPatOmTbr++ut1wgkn6LLLLivHLw0AgFAp2zM806dPH/zR2Nh41G0NDQ2Shr6k9eGHH8qyLP3sZz/Tl7/8ZVVXV+uMM87QW2+9pXfeeUdnn322ampqdO6552rv3r1Dvt5zzz03+AzK3Llzdeeddxb9tvgPPvigVq5cqTvvvFOnnXaa7rzzTv3BH/yBHnzwwRHPSSaTeuSRR/Tss8/q0ksv1bx583TGGWfooosuGjzmscce04knnqhHHnlEp512mq699lqtWbNGDzzwQFH7AADA6Ey4a3iGc/fdd+vP//zPtX37djU2NuqKK67Qd77zHd1777167bXX1N/frxtvvHHw+Oeff17f/OY3tXbtWu3cuVP/8i//oqefflp33HHH4DH33HOPLMsq+HW3bNmir3zlK0Nuu/DCC/Xyyy+PeM6zzz6refPm6de//rXmzZunOXPmaM2aNWprazvm427dunXMn3EEAABGdlwEz/e+9z1ddNFFmj9/vm6++Wa9++67+s53vqOVK1dq4cKFWrt2rdavXz94/L333qtbb71V3/rWt3TyySdr5cqVuv/++/XYY4/J8zxJ0pQpU4553cGnn36qadOmDblt2rRp+vTTT0c8Z8+ePdq3b59+9rOf6Sc/+YmeeOIJ7dq1S5dccolc1y34uLlcTu3t7UX93gAAgGMr2zU8pVi8ePHg/38WCosWLRpyW09Pj3p7exWLxbRt2za99tpruv/++wePcV1XfX19+vTTTzVjxgytXbtWa9euHfetrutqYGBATzzxhE499VRJ0hNPPKFEIqHXX3+94LU/AADAH8dF8FRUVAz+/2cvQw1322fPoLiuq7vvvluXX375UY91wgknjPrrTp8+XQcOHBhy24EDBwpeWD1jxgxFIpHB2JGOfMuu4zj66KOPdOaZZ474uJFIRFOmTBn1PgAAMDrHxUtaxVq6dKl27dqlU0455agfkcjoG++ss87SCy+8MOS2F154QWefffaI55xzzjnK5XL64IMPBm/bs2eP8vm8mpubCz7usmXLhoQcAAAYH0YGz1133aV///d/11133aV33nlHu3bt0tNPP63bbrtt8Jh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XV1mjp1qq644gp9+umng/dfddVVWr16tR566CHNnDlTTU1N+ta3vqXe3t7BY37961/rS1/6kpqamjRp0iRdeOGFeu+99wbv//DDD2VZln7605/q/PPPV3V1tX70ox8N+5LWL37xCy1atEjRaFQnnXSS7r33XnmeV/TvTzab1RVXXKF7771X8+bNK/p8YCJIJBJBTwCAgnwPntraWtXW1upXv/qV+vv7RzxuzZo1evzxx/X3f//3eu+99/TjH/9YjY2NkqTW1ladd955amlp0WuvvaYXX3xR3d3duvTSS+W67uBjbNy4Ue+8845efPFFPfXUU/rlL3+phx56aPD+np4e3XTTTXrttdf0m9/8Rg0NDbrkkkuUyWSGbPn+97+v66+/Xu+++66+9rWvHbV127Ztuvzyy/X1r39db7/9tu677z798Ic/1KOPPjp4zD333CPLso75+3PnnXdqzpw5WrNmzTGPBQAAY+R53og/vvCFL3jj4emnn/aampq8aDTqrVixwrv55pu9V155ZfD+3bt3e5K8//7v/x72/L/8y7/0zj///CG3/e53v/Mkea+++qrneZ63Zs0ab9asWV4ulxs85pprrvFWrVo14q7u7m7Ptm1v48aNnud53t69ez1J3gMPPDDkuPXr13uSvIMHD3qe53lXXnmlt3LlyiHH3H333d7MmTMHf/7II494iURixK/teZ73/PPPe83Nzd7hw4cHfw0XX3xxwXOAsXjuuedGfeyB2bO9A7Nn+7imeMXsBxBekrZ6IzRNWS5avuyyy/TJJ5/oueee0x/90R/p5Zdf1ooVK/SDH/xAkrR9+3bZtq2VK1cOe/62bdu0YcOGwWeLamtrddJJJ0mSPvjgg8HjFixYIMdxBn9+4oknqq2tbfDnH3zwga688kqdfPLJqq+v17Rp0+S6rj766KMhX2/ZsmUFfz3vvfeezjnnnCG3nXvuudq/f7+6urokSWvXrtWuXbtGfIyDBw/qqquu0r/+678OPpMFAAD8UZaLliWpqqpKF1xwgS644ALddddduuaaa3TPPffolltuOea5ruvq4osv1gMPPHDUfdOmTRv8/4qKiiH3WZY15CWv1atXa9asWfrRj36kmTNnKhKJaMGCBUe9pFVTU1P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kDA6rZsEENDQ068cQTdcIJJwQ9EwBKQvAAIdbX16ctW7aor6/v/z7SwXGUj8XU1dWlrq4u7d+/X/Pnz9e8efOCHQsAJSB4gJDq6urSK6+8omw2W/Dzq1zXVTKZVF9fnxYsWCDLssq4EgDGB9fwACG1bds2ZTKZUX1YZz6f10cffaT29vYyLAOA8UfwACHkeZ76+vqKPqe7u9unRQDgL4IHCKFMJlP0Oa7rEjwAjlsEDxBCvb29su3i//in02kf1gCA/wgeIITy+fyYzsvlcuO8BADKg+ABULJkMhn0BAAoiOABULJUKnXUbWN5yczzvDGdBwDHwt8sAHxRU1NT9Dmu66q6utqHNQDCjuAB4Iu6urqiz3EcR5EI74cKYPwRPAB8UVtbK8dxijqnqqrKpzUAwo7gAVCyeDx+1G1Tp04t6jEcx9HcuXPHaxIADEHwAChZIpE46rbKykqddtppo36Wp6qqSrNnzx7vaQAgieAB4KPm5mZFo9FjHmfbtpYsWcIHkwLwDcEDwDeWZemMM85QLBaTZVmDFyV/9l/LslRZWak5c+aoqakp6LkADMa3QwDwVVNTk84//3x5nqfe3l6l02lls1nV1dWptraW78oCUBb8TQOgLCzLUk1NzZjenwcASsVLWgAAwHiW53kj32lZByXtK98cAACAMWv2PO+E4e4oGDwAAAAm4CUtAABgPIIHAAAYj+ABAADGI3gAAIDxCB4AAGC8/w8mb0SIGrkgGgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 720x720 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "params_src_sink_right = params[\"Scenario\"][\"Generation\"][\"ConfigurableScenarioGeneration\"][\"SinksSources\"][1]\n",
    "params_src_sink_right[\"ConfigGoalDefinitions\"][\"GoalTypeControlled\"] = \"LaneChangeLeft\"\n",
    "\n",
    "params_src_sink_left = params[\"Scenario\"][\"Generation\"][\"ConfigurableScenarioGeneration\"][\"SinksSources\"][0]\n",
    "params_src_sink_left[\"ConfigAgentStatesGeometries\"][\"VehicleDistanceRange\"] = [3, 6]\n",
    "params_src_sink_left[\"ConfigAgentStatesGeometries\"][\"OtherVehicleVelocityRange\"] = [3, 6]\n",
    "\n",
    "scenario_generation = ConfigurableScenarioGeneration(num_scenarios = 5, params = params)\n",
    "\n",
    "num_scenarios_to_show = 5\n",
    "num_steps_per_scenario = 4\n",
    "step_time = 0.2\n",
    "\n",
    "for _ in range(0, num_scenarios_to_show):\n",
    "    scenario, idx = scenario_generation.get_next_scenario()\n",
    "    world = scenario.GetWorldState()\n",
    "    for _ in range(0, num_steps_per_scenario): \n",
    "      viewer.drawWorld(world, eval_agent_ids=scenario._eval_agent_ids, scenario_idx=idx )\n",
    "      display.clear_output(wait=True)\n",
    "      display.display(viewer.axes.get_figure())\n",
    "      world.Step(step_time)\n",
    "      viewer.clear()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.5 Conflict Resolution between Source Sink Configs\n",
    "\n",
    "As discussed, the config reader chain is processed separately for each source sink config. To avoid **physical** overlapping of initial agent states, we can use the conflict resolution specification between source and sinks. \n",
    "\n",
    "Especially in intersection scearions overlaps occur within the intersection or when building scenarios where vehicles should either turn left or go straight.\n",
    "\n",
    "In the following, we show an intersection scenario and explaing the conflict resolution."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb4AAAEuCAYAAADx63eqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XtwVNd9B/Dvvbvah54r9ERvQCCQMCBQCC+DAWPHdjPJOHWc4s7E7tBMx3bSjEmb2G1tT1MnTift1JNMp5mMO43buqXG9UySjieFGhwMAvEwLyEhoSegtxCSdqVd7e49/YPuVqsrac/uXj3M/X5m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Q91EhGRqTD4iIjIVBh8RERkKgw+IiIyFQYfERGZyv8CE5HYxZDmAC4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "scenario_param_file =\"intersection_configurable.json\" # must be within examples params folder\n",
    "param_server = ParameterServer(filename= os.path.join(\"examples/params/\",scenario_param_file))\n",
    "scenario_generation = ConfigurableScenarioGeneration(num_scenarios=20, random_seed=0, params=param_server)\n",
    "\n",
    "viewer = MPViewer(params=param_server, use_world_bounds=True)\n",
    "sim_step_time = param_server[\"simulation\"][\"step_time\",\n",
    "                                           \"Step-time used in simulation\",\n",
    "                                           0.2]\n",
    "sim_real_time_factor = param_server[\"simulation\"][\"real_time_factor\",\n",
    "                                                  \"execution in real-time or faster\", 1]\n",
    "scenario, idx = scenario_generation.get_next_scenario()\n",
    "\n",
    "\n",
    "num_scenarios_to_show = 20\n",
    "num_steps_per_scenario = 20\n",
    "step_time = 0.2\n",
    "\n",
    "for _ in range(0, num_scenarios_to_show):\n",
    "    scenario, idx = scenario_generation.get_next_scenario()\n",
    "    world = scenario.get_world_state()\n",
    "    for _ in range(0, num_steps_per_scenario): \n",
    "      viewer.drawWorld(world, eval_agent_ids=scenario._eval_agent_ids, scenario_idx=idx )\n",
    "      display.clear_output(wait=True)\n",
    "      display.display(viewer.axes.get_figure())\n",
    "      world.Step(step_time)\n",
    "      viewer.clear()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For this scenario, we specified three source sink configurations for the west->east corridor, the south->west corridor and east->west corridor. In the scenario generation param file, we specified how overlaps should be resolved as follows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"west_south/west_east\": [\n",
      "        0.45,\n",
      "        0.55\n",
      "    ],\n",
      "    \"south_west/west_east\": [\n",
      "        0.5,\n",
      "        0.5\n",
      "    ],\n",
      "    \"south_west/west_south\": [\n",
      "        0.5,\n",
      "        0.5\n",
      "    ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(param_server[\"Scenario\"][\"Generation\"] \\\n",
    "                     [\"ConfigurableScenarioGeneration\"][\"ConflictResolution\"].ConvertToDict(), indent=4))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The names used correspond to the source sink description given in the definition of the respective source sink config. The numbers specify with what probability an overlap is resolved using a vehicle from one or the other corridor. We continue with writing our own config reader."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.5 Writing an own config reader to sample behavior type\n",
    "There is a number of config readers defined in [config_readers](https://github.com/bark-simulator/bark/tree/master/bark/runtime/scenario/scenario_generation/config_readers) and we plan to extend this set further in the future. \n",
    "\n",
    "In this section, we demonstrate how to write your own config reader, writing a config reader for behavior model sampling. But the process can be easily applied to the other config reader types as well.\n",
    "\n",
    "The config reader shall randomly sample behavior types among a list of specified behavior types. We reimplement the interface of ConfigReaderBehaviorModels as follows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bark.runtime.scenario.scenario_generation.config_readers.config_readers_interfaces import ConfigReaderBehaviorModels\n",
    "from bark.core.models.behavior import *\n",
    "from bark.runtime.commons.parameters import ParameterServer\n",
    "\n",
    "class SampleBehaviorType(ConfigReaderBehaviorModels):\n",
    "  def __init__(self, random_state):\n",
    "    super().__init__(random_state)\n",
    "    self.param_servers = []\n",
    "\n",
    "  def create_from_config(self, config_param_object, road_corridor, agent_states,  **kwargs):\n",
    "    model_types = config_param_object[\"ModelTypesList\", \"Type of behavior model\" \\\n",
    "                \"used for all vehicles\", [\"BehaviorIDMClassic\", \"BehaviorMobil\"]]\n",
    "    model_params = config_param_object.AddChild(\"ModelParams\")\n",
    "    # ----- DEFAULT PARAMETER HANDLING\n",
    "    # based on types retrieve default params which are maintained as scenario defaults\n",
    "    for model_type in model_types:\n",
    "        behavior_params = model_params.AddChild(model_type)\n",
    "        _, _ = self.model_from_model_type(model_type, behavior_params)\n",
    "        #param server must be persisted for each behavior to enable serialization of parameters\n",
    "        \n",
    "\n",
    "    #------ BEHAVIOR MODEL SAMPLING\n",
    "    behavior_models = []\n",
    "    behavior_model_types = []\n",
    "    for _ in agent_states:\n",
    "        model_idx = self.random_state.randint(low=0, high=len(model_types), size=None) \n",
    "        model_type = model_types[model_idx]\n",
    "        model_type_params = model_params.AddChild(model_type)\n",
    "        params = ParameterServer()\n",
    "        bark_model, params = self.model_from_model_type(model_type, model_type_params)\n",
    "        self.param_servers.append(model_type_params) \n",
    "        behavior_models.append(bark_model)\n",
    "        behavior_model_types.append(model_type)\n",
    "    return behavior_models, {\"behavior_model_types\" : behavior_model_types}, config_param_object\n",
    "\n",
    "  def model_from_model_type(self, model_type, params):\n",
    "    bark_model = eval(\"{}(params)\".format(model_type))    \n",
    "    return bark_model, params\n",
    "\n",
    "  def get_param_servers(self):\n",
    "    return self.param_servers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The main functionality is covered in `create_from_config(self, config_param_object, road_corridor, agent_states,  **kwargs)`. Here, we first read a list of behavior types from the parameter server and read it out the default parameters of these model types. Then, we use the global random seed state managed by the scenario generation to sample the behavior types. Note that the parameter servers of objects must be persisted to allow for serialization of behavior models. This class definition must be found by ConfigurableScenarioGeneration. We put it into the [behavior_model_config_readers.py](https://github.com/bark-simulator/bark/blob/master/bark/runtime/scenario/scenario_generation/config_readers/behavior_model_config_readers.py) containing the already existing ConfigReaderBehaviorModels.\n",
    "\n",
    "Now, we use this config to randomly sample Mobil and IDM models on the right highway lane. We can first set the type of ConfigBehaviorModels to our new definition. By rerunning the scenario generation, all **default parameters are automatically extracted**. Afterwards, we can finetune these parameters. First let's specify the new config type and extract the defaults. To specify a config type simply use the name given to the config reader class. We now have the following initial source sink config and running the scenario generation gives as the default params. These can of course be customized as desired"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      " ------ ConfigBehaviorModels Default Parameters ---------\n",
      "{\n",
      "    \"Type\": \"SampleBehaviorType\",\n",
      "    \"ModelTypesList\": [\n",
      "        \"BehaviorIDMClassic\",\n",
      "        \"BehaviorMobil\"\n",
      "    ],\n",
      "    \"ModelParams\": {\n",
      "        \"BehaviorIDMClassic\": {\n",
      "            \"BehaviorIDMClassic\": {\n",
      "                \"MinimumSpacing\": 2.0,\n",
      "                \"DesiredTimeHeadway\": 1.5,\n",
      "                \"MaxAcceleration\": 1.7000000476837158,\n",
      "                \"AccelerationLowerBound\": -5.0,\n",
      "                \"AccelerationUpperBound\": 8.0,\n",
      "                \"DesiredVelocity\": 15.0,\n",
      "                \"ComfortableBrakingAcceleration\": 1.6699999570846558,\n",
      "                \"MinVelocity\": 0.0,\n",
      "                \"MaxVelocity\": 50.0,\n",
      "                \"Exponent\": 4\n",
      "            }\n",
      "        },\n",
      "        \"BehaviorMobil\": {\n",
      "            \"BehaviorMobil\": {\n",
      "                \"BehaviorIDMClassic\": {\n",
      "                    \"MinimumSpacing\": 2.0,\n",
      "                    \"DesiredTimeHeadway\": 1.5,\n",
      "                    \"MaxAcceleration\": 1.7000000476837158,\n",
      "                    \"AccelerationLowerBound\": -5.0,\n",
      "                    \"AccelerationUpperBound\": 8.0,\n",
      "                    \"DesiredVelocity\": 15.0,\n",
      "                    \"ComfortableBrakingAcceleration\": 1.6699999570846558,\n",
      "                    \"MinVelocity\": 0.0,\n",
      "                    \"MaxVelocity\": 50.0,\n",
      "                    \"Exponent\": 4\n",
      "                },\n",
      "                \"CrosstrackErrorGain\": 1.0,\n",
      "                \"PolitenessFactor\": 0.3499999940395355,\n",
      "                \"AccelerationThreshold\": 0.10000000149011612,\n",
      "                \"AccelerationBias\": 0.10000000149011612,\n",
      "                \"SafeDeceleration\": 2.0,\n",
      "                \"AsymmetricPassingRules\": false,\n",
      "                \"CriticalVelocity\": 16.65999984741211,\n",
      "                \"StopAtLaneEnding\": true\n",
      "            }\n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "sink_source_dict = [{\n",
    "      \"SourceSink\": [[5111.626, 5006.8305],  [5110.789, 5193.1725] ],\n",
    "      \"Description\": \"left_lane\",\n",
    "      \"ConfigAgentStatesGeometries\": {\"Type\": \"UniformVehicleDistribution\", \"LanePositions\": [0]},\n",
    "      \"ConfigBehaviorModels\": {\"Type\": \"FixedBehaviorType\"},\n",
    "      \"ConfigExecutionModels\": {\"Type\": \"FixedExecutionType\"},\n",
    "      \"ConfigDynamicModels\": {\"Type\": \"FixedDynamicType\"},\n",
    "      \"ConfigGoalDefinitions\": {\"Type\": \"FixedGoalTypes\"},\n",
    "      \"ConfigControlledAgents\": {\"Type\": \"NoneControlled\"},\n",
    "      \"AgentParams\" : {}\n",
    "    },\n",
    "    {\n",
    "      \"SourceSink\": [[5111.626, 5006.8305],  [5110.789, 5193.1725] ],\n",
    "      \"Description\": \"right_lane\",\n",
    "      \"ConfigAgentStatesGeometries\": {\"Type\": \"UniformVehicleDistribution\", \"LanePositions\": [1]},\n",
    "      \"ConfigBehaviorModels\": {\"Type\": \"SampleBehaviorType\"},\n",
    "      \"ConfigExecutionModels\": {\"Type\": \"FixedExecutionType\"},\n",
    "      \"ConfigDynamicModels\": {\"Type\": \"FixedDynamicType\"},\n",
    "      \"ConfigGoalDefinitions\": {\"Type\": \"FixedGoalTypes\"},\n",
    "      \"ConfigControlledAgents\": {\"Type\": \"RandomSingleAgent\"},\n",
    "      \"AgentParams\" : {}\n",
    "    }]\n",
    "params = ParameterServer()\n",
    "params[\"World\"][\"remove_agents_out_of_map\"] = True\n",
    "params[\"Scenario\"][\"Generation\"][\"ConfigurableScenarioGeneration\"][\"SinksSources\"] = sink_source_dict\n",
    "scenario_generation = ConfigurableScenarioGeneration(num_scenarios=2,params=params)\n",
    "\n",
    "print(\"\\n\\n ------ ConfigBehaviorModels Default Parameters ---------\")\n",
    "print(json.dumps(params[\"Scenario\"][\"Generation\"][\"ConfigurableScenarioGeneration\"][\"SinksSources\"][1][\"ConfigBehaviorModels\"], indent=4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAIuCAYAAAC7EdIKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xuw3HV9//H37p7k5HpyTi4QSTRQWDYXoAhRAiiWRIpIHJ221BKcEVraaQEvQ6xYaAHLRLGDjlj+qOPQKVitFJCZko7tgAWNGK5Frsmy5SKjuZCES5JDknPOnu/vD4fz83gSIJr9fvHzfTxmMuTsfvfsK/kj8+T73bNbybIsAABSVi16AABApwkeACB5ggcASJ7gAQCSJ3gAgOQJHgAgeV2vd+fMmTOzQw89NKcpQCpeeeWVmDZt2j7v3717d0yYMOHXfjzA3jz00ENbsyybtbf7Xjd4Dj300HjwwQc7swpI1urVq2P58uUdux9gbyqVyk/3dZ9LWgBA8gQPAJA8wQPkrl6vFz0BKBnBA+Su0WgUPQEoGcEDACRP8AAAyRM8AEDyBA8AkDzBAwAkT/AAAMkTPABA8gQPAJA8wQPkrtlsFj0BKBnBA+Su1WoVPQEoGcEDACRP8AAAyRM8AEDyBA+Qu3q9XvQEoGQED5C7RqNR9ASgZAQPAJA8wQMAJE/wAADJEzwAQPIEDwCQPMEDACTvLRU8lUolbrnllqJnAACJySV4KpXK6/4699xzIyJi48aN8aEPfSiPSW/o5ptvjsWLF0dvb29Mnjw5jj322Ljhhhve8HEPPPBAvP/974/e3t7o7e2NZcuWxf333z/qmMceeyze9773xcSJE2POnDnx93//95FlWaf+KABQel15PMnGjRtHfr969er48z//81G3TZw4MSIiZs+encecN2XGjBnxt3/7tzF//vwYN25crF69Ov7sz/4sZs2aFR/84Af3+pidO3fGBz7wgTjzzDPj3nvvjSzLYtWqVXH66afH888/H1OnTo3t27fHaaedFqeccko88MADsX79+jjvvPNi8uTJsXLlypz/lFCMZrPpzQeBXOVyhmf27Nkjv3p7e8fcNm3atIgYfUnrueeei0qlEt/5zndGzoa8853vjEcffTQef/zxOOmkk2Ly5Mnxnve8J5599tlRz3f77bfH8ccfHxMmTIjDDjssLrvsshgYGNivzUuXLo2PfOQjMX/+/Dj88MPjU5/6VBxzzDGxZs2afT5m/fr18eKLL8bnP//5mD9/fixYsCCuuuqqePnll6PZbEZExLe+9a149dVX44Ybboijjjoq/uiP/iguueSS+MpXvuIsD6XRarWKngCUzFvqNTx7c8UVV8Qll1wSDz/8cPT29sbZZ58dn/jEJ2LVqlVx//33x+7du+OTn/zkyPH//d//Heecc05cdNFF8cQTT8Q///M/xy233BKXXnrpyDFXXnllVCqVN70hy7L4/ve/H81mM0455ZR9HtdoNGLWrFlx/fXXx549e2LPnj3xjW98I97xjnfEokWLIiJi7dq18d73vnfkrFZExOmnnx4bNmyI5557bj/+ZgCAN+stHzwXX3xxfPCDH4z58+fHypUr48knn4xPfOITceqpp8aiRYvioosuirvuumvk+FWrVsVf//Vfx3nnnReHH354nHrqqfGlL30p/umf/mnkDMrMmTPf1On0V155JaZMmRLjx4+PM888M772ta/FGWecsc/jp06dGnfffXf8+7//e0yaNCkmTZoUN910U9xxxx0jgbNp06Y4+OCDRz3uta83bdq0338/AMAbe8sHzzHHHDPy+9fC4Oijjx51W39/f7z66qsREfHQQw/FqlWrYsqUKSO/VqxYEf39/SNBcdFFF8X69evf8LmnTp0aP/nJT+KBBx6IVatWxcUXXxzf//7393n8rl274k//9E9jyZIlce+998Y999wT73znO+PDH/5w9Pf3/1p/fvhtNzAwEK+++qpLtkChcnnR8m9i3LhxI79/7TLU3m4bHh4e+e8VV1wRZ5111pjvNWvWrP167mq1GkcccURERBx77LGxbt26+MIXvhDLli3b6/Hf/va34+mnn4577rknarXayG19fX1x2223xcc+9rGYPXt2bN68edTjXvv6rfSibfhNtdvt+N///d944YUXolqtRq1WiyVLlkRPT0/U6/Wi5wEl85YPnv113HHHxfr160dC5UAaHh6OPXv27PP+V199NSqVSlSr///EWbVajUqlMhJkJ554YlxyySWxe/fumDBhQkRE3HHHHXHIIYfEoYceesA3Q1E2b94cW7dujSzLot1uR7vdHvmBAz+hBeTtLX9Ja39dfvnl8e1vfzsuv/zyePzxx2P9+vVxyy23xGc/+9mRY6677rqYP3/+636fVatWxZ133hnPPPNMrFu3Lr785S/HN7/5zfjYxz62z+9z2mmnxfbt2+OCCy6IdevWxRNPPBHnnXde1Gq1WLp0aURErFixIiZNmhTnnntuPP744/Hd7343rr766rj44ov364XU8Fa3e/fukdB/za5duwpaA5Rdcmd4Tj/99PjP//zPuOqqq+Kaa66Jrq6uOPLII0fe3DAiYuvWrSM/Jr4vO3fujL/6q7+Kn/3sZzFx4sSYP39+3HjjjXH22Wfv8/vMnz8/br/99vj85z8fJ554YlQqlTj22GPje9/7XsydOzciIqZNmxZ33HFHXHjhhbF48eLo6+uLlStXxsUXX3xg/yKgYG/mNTvtdjtefPHFGBoaimnTpsWkSZNyWAaUUeX1/lFavHhx9uCDD+Y4B0jB6tWrY8GCBbF+/fpR4TNx4sSR18ANDg7GPffcE7t27YpKpRJZlsWxxx4bb3vb22L16tWxfPnyouYDv6UqlcpDWZYt3tt9yV3SAn47bNmyJXbt2hXtdjuGhoai3W7HU089VfQsIFGCByjEwMDAmMte+/uO6ABvluABAJIneICO8FOHwFuJ4AE6oru7e9R7UkXEyHtPAeRN8AAdcdBBB406y1Or1UbeXPON3hYC4EBL7n14gLeGcePGxZIlS2LDhg0xMDAQM2bMiEMOOSQiIlqtVhx11FEFLwTKRPAAHdPb2xu9vb17vc9rfIA8uaQFFGLSpEljomfy5MkFrQFSJ3iAQsycOTMmTJgQtVotqtVqVKvVOPLII4ueBSTKJS0gd/V6PSqVSpx88smxbdu2GBwcjJ6enn1e/gL4TQkeIHeNRiMiIsaPHx9ve9vbCl4DlIFLWgBA8gQPAJA8wQMAJE/wAADJEzxvwt133x2VSiW2bt1a9BQA4NeQS/Bs2bIlLrjggjj00EOju7s7Dj744Fi2bFnccccdeTz9b+ykk06KjRs3xowZMw7497711ltj4cKF0d3dHQsXLozbbrvtgD8HAJRdLsHzh3/4h3H//ffH9ddfH0899VSsXr06zjjjjNi2bVseT/8bGRwcjPHjx8fs2bMP+Fvhr127Nj760Y/GOeecEz/5yU/inHPOibPOOivuu+++A/o8AFB2HQ+el19+OdasWRNXX311LFu2LObNmxfvete74jOf+Uz8yZ/8ychxAwMDcemll8a8efOiu7s7fud3fie+9rWvjdz/5JNPxplnnhlTp06Ngw46KM4+++zYtGnTyP3nnntuLF++PK699tqYM2dO9PX1xXnnnRevvvrqyDH/9V//Fe9973ujr68vpk+fHqeffnqsW7du5P7nnnsuKpVK/Nu//VssXbo0Jk6cGF//+tf3eknru9/9bhx99NHR3d0db3/722PVqlWRZdl+/d189atfjVNPPTUuu+yyWLBgQVx22WXxe7/3e/HVr351v74PAPD6Oh48U6ZMiSlTpsR//Md/xO7du/d53Mc//vG48cYb4ytf+UqsW7curr/++pF3Xd24cWOccsopcdRRR8X9998fd955Z+zcuTM+/OEPx/Dw8Mj3WLNmTTz++ONx5513xk033RS33XZbXHvttSP39/f3x6c//em4//774+67745p06bFhz70oRgYGBi15W/+5m/iggsuiCeffDI+8pGPjNn60EMPxVlnnRV/8Ad/EI899lhcffXV8cUvfjGuu+66kWOuvPLKNzwjtHbt2vj93//9Ubedfvrp8eMf//h1Hwe/7ZrNZtETgLLJsmyfv44//vjsQLjllluyvr6+rLu7O1uyZEm2cuXK7N577x25/6mnnsoiIvve976318f/3d/9XbZ06dJRt7344otZRGT33XdflmVZ9vGPfzybO3duNjQ0NHLM+eefny1btmyfu3bu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ie4AEAkvf/AKPY3CxyxPJKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 720x720 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10, 10))\n",
    "viewer = MPViewer(\n",
    "  params=params,\n",
    "  y_length = 80,\n",
    "  enforce_y_length=True,\n",
    "  enforce_x_length=False,\n",
    "  use_world_bounds=True,\n",
    "  axis=plt.gca())\n",
    "\n",
    "num_scenarios_to_show = 5\n",
    "num_steps_per_scenario = 20\n",
    "step_time = 0.2\n",
    "\n",
    "for _ in range(0, num_scenarios_to_show):\n",
    "    scenario, idx = scenario_generation.get_next_scenario()\n",
    "    world = scenario.GetWorldState()\n",
    "    for _ in range(0, num_steps_per_scenario): \n",
    "      viewer.drawWorld(world, eval_agent_ids=scenario._eval_agent_ids, scenario_idx=idx )\n",
    "      display.clear_output(wait=True)\n",
    "      display.display(viewer.axes.get_figure())\n",
    "      world.Step(step_time)\n",
    "      viewer.clear()"
   ]
  }
 ],
 "metadata": {
  "file_extension": ".py",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "mimetype": "text/x-python",
  "name": "python",
  "npconvert_exporter": "python",
  "pygments_lexer": "ipython3",
  "version": 3
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
